<?php

/**
 * This is the model class for table "bln_operation_request".
 *
 * The followings are the available columns in table 'bln_operation_request':
 * @property integer $_id
 * @property string $operationname
 * @property string $operationdata
 * @property string $status
 * @property integer $start_time
 * @property integer $alive_length
 * @property integer $to_user
 * @property integer $to_Space
 * @property integer $to_Space_app
 * @property integer $from_user
 * @property integer $from_Space
 * @property integer $from_Space_app
 */
class BMOperationRequest extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return BMOperationRequest the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'bln_operation_request';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('operationname, status, start_time, alive_length, to_user, to_Space, to_Space_app, from_user, from_Space, from_Space_app', 'required'),
			array('start_time, alive_length, to_user, to_Space, to_Space_app, from_user, from_Space, from_Space_app', 'numerical', 'integerOnly'=>true),
			array('operationname, status', 'length', 'max'=>128),
			array('operationdata', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('_id, operationname, operationdata, status, start_time, alive_length, to_user, to_Space, to_Space_app, from_user, from_Space, from_Space_app', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'_id' => 'ID',
			'operationname' => 'Operationname',
			'operationdata' => 'Operationdata',
			'status' => 'Status',
			'start_time' => 'Start Time',
			'alive_length' => 'Alive Length',
			'to_user' => 'To User',
			'to_Space' => 'To Space',
			'to_Space_app' => 'To Space App',
			'from_user' => 'From User',
			'from_Space' => 'From Space',
			'from_Space_app' => 'From Space App',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('_id',$this->_id);
		$criteria->compare('operationname',$this->operationname,true);
		$criteria->compare('operationdata',$this->operationdata,true);
		$criteria->compare('status',$this->status,true);
		$criteria->compare('start_time',$this->start_time);
		$criteria->compare('alive_length',$this->alive_length);
		$criteria->compare('to_user',$this->to_user);
		$criteria->compare('to_Space',$this->to_Space);
		$criteria->compare('to_Space_app',$this->to_Space_app);
		$criteria->compare('from_user',$this->from_user);
		$criteria->compare('from_Space',$this->from_Space);
		$criteria->compare('from_Space_app',$this->from_Space_app);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}